Skip to content

Conversation

@Amansingh0807
Copy link
Contributor

@Amansingh0807 Amansingh0807 commented Dec 5, 2025

type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes. report:

  • task: lint_filenames status: passed
  • task: lint_editorconfig status: passed
  • task: lint_markdown status: passed
  • task: lint_package_json status: passed
  • task: lint_repl_help status: passed
  • task: lint_javascript_src status: passed
  • task: lint_javascript_cli status: na
  • task: lint_javascript_examples status: passed
  • task: lint_javascript_tests status: passed
  • task: lint_javascript_benchmarks status: passed
  • task: lint_python status: na
  • task: lint_r status: na
  • task: lint_c_src status: passed
  • task: lint_c_examples status: passed
  • task: lint_c_benchmarks status: passed
  • task: lint_c_tests_fixtures status: na
  • task: lint_shell status: na
  • task: lint_typescript_declarations status: passed
  • task: lint_typescript_tests status: passed
  • task: lint_license_headers status: passed ---

Resolves a part of #649

Description

What is the purpose of this pull request?

This pull request:

  • adds a C implementation for @stdlib/math/base/special/asechf.

The package computes the hyperbolic arcsecant of a single-precision floating-point number using the relationship:

$$asechf(x) = acosh(1/x)$$

Since acoshf does not yet have a C implementation, this implementation uses the double-precision acosh function with appropriate float conversions.

Related Issues

Does this pull request have any related issues?

This pull request has the following related issues:

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

No.

Checklist

Please ensure the following tasks are completed before submitting this pull request.

AI Assistance

When authoring the changes proposed in this PR, did you use any kind of AI assistance?

  • Yes
  • No

If you answered "yes" above, how did you use AI assistance?

  • Code generation (e.g., when writing an implementation or fixing a bug)
  • Test/benchmark generation
  • Documentation (including examples)
  • Research and understanding

Disclosure

If you answered "yes" to using AI assistance, please provide a short disclosure indicating how you used AI assistance. This helps reviewers determine how much scrutiny to apply when reviewing your contribution. Example disclosures: "This PR was written primarily by Claude Code." or "I consulted ChatGPT to understand the codebase, but the proposed changes were fully authored manually by myself.".

I used AI to generate the boilerplate code for the benchmark files and to generate the numerical test fixtures (input/output pairs) for test.c. The core implementation logic and mathematical correctness were manually verified against standard definitions.


@stdlib-js/reviewers

Copilot AI review requested due to automatic review settings December 5, 2025 15:11
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@stdlib-bot stdlib-bot added Math Issue or pull request specific to math functionality. Needs Review A pull request which needs code review. labels Dec 5, 2025
@stdlib-bot
Copy link
Contributor

stdlib-bot commented Dec 5, 2025

Coverage Report

Package Statements Branches Functions Lines
math/base/special/asechf $\color{red}157/160$
$\color{green}+0.00%$
$\color{green}4/4$
$\color{green}+0.00%$
$\color{red}1/2$
$\color{green}+0.00%$
$\color{red}157/160$
$\color{green}+0.00%$

The above coverage report was generated for the changes in this PR.

@Amansingh0807
Copy link
Contributor Author

Amansingh0807 commented Dec 7, 2025

Hi @kgryte! I have implemented the C version of asechf (hyperbolic arcsecant for single-precision floats).

Implementation uses the formula: asechf(x) = acosh(1/x)

Since acoshf doesn't exist in stdlib yet, I'm using acosh (double-precision) with proper float conversions:

  • C: (float)stdlib_base_acosh((double)(1.0f / x))
  • JS: float64ToFloat32(acosh(1.0 / float64ToFloat32(x)))

This approach maintains accuracy while avoiding dependency on non-existent acoshf. The implementation can be optimized later when acoshf is added.

All tests passing, It follows stdlib conventions. Ready for review!

Ref: #649

@Amansingh0807 Amansingh0807 changed the title feat: add C implementation for @stdlib/math/base/special/asechf feat: add C implementation for math/base/special/asechf Dec 9, 2025
@Amansingh0807 Amansingh0807 changed the title feat: add C implementation for math/base/special/asechf feat: add math/base/special/asechf Dec 9, 2025
@kgryte
Copy link
Member

kgryte commented Dec 9, 2025

We need acoshf to be implemented before this PR can move forward; otherwise, we are just creating technical debt.

@kgryte kgryte added status: Blocked Issue or pull request which is currently blocked. and removed Needs Review A pull request which needs code review. labels Dec 9, 2025
@kgryte
Copy link
Member

kgryte commented Dec 9, 2025

Ref: #5812

@Amansingh0807
Copy link
Contributor Author

Understood @kgryte. I agree that waiting for acoshf avoids future refactoring.

I will keep this PR open and monitor the progress of acoshf. Once that lands, I will update this implementation to use stdlib_base_acoshf directly and ping you for review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Math Issue or pull request specific to math functionality. status: Blocked Issue or pull request which is currently blocked.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants